<?php

namespace frontend\modules\yii2;

use Yii;
use common\models\Request;

/**
 * yii2 module definition class
 */
class Module extends \yii\base\Module
{
    /**
     * {@inheritdoc}
     */
    public $controllerNamespace = 'frontend\modules\yii2\controllers';

    /**
     * {@inheritdoc}
     */
    public function init()
    {
        parent::init();

        // custom initialization code goes here
        $request = new Request();
        $request->module = "yii";
        $request->url = Yii::$app->request->getPathInfo();
        $request->ip = Yii::$app->request->getRemoteIP();
        $request->created_at = date("Y-m-d H:i:s");
        $request->save();
    }
}
